﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">  
<html xmlns="http://www.w3.org/1999/xhtml">  
    <head>  
        <title>接口测试</title>  
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>  
        <style type="text/css">  
            body {font-size:12px; font-family:Tahoma;}  
            .tit0 {  
                    background-color: #DAEAF9;  
                    padding-left: 5px;  
                    font-size:15px;  
                 }  
            .tit1 {  
                    background-color: #FFF2AA;  
                    padding-left: 5px;  
                    font-size:15px;  
                 }  
            .tit2 {  
                    background-color: #DAEAF9;  
                    font-size:12px;  
                 }  
        </style>  
        <script type="text/javascript">  
           // var document.getElementById= document.getElementById;  
            // 页面初始化读取的文件路径，根据自身要求进行修改  
            var filePath = "E:\\接口测试\\请求报文.xml";  
              
            function sendxml() {   
				try{
                var xmlhttp = new ActiveXObject("MICROSOFT.XMLHTTP");  
                xmlhttp.open("POST", document.getElementById("servletur2").value, false);  
                xmlhttp.send(document.getElementById("RSXML").value);  
                document.getElementById("RQXML").value = xmlhttp.responseText;  
                if (document.getElementById("RQXML").value.length > 0) {  
                    alert("请求成功！");                      
                } else {  
                    alert("请求失败！");  
                } 
				}catch(e){
					alert(e);
					}
            }  
            function readFile(inFilePath) {  
			 
                var fso = new ActiveXObject("Scripting.FileSystemObject");  
				 
                var textFile = fso.GetFile(inFilePath);  
				 
                var ts = fso.OpenTextFile(inFilePath, 1);   
				 
                document.getElementById("RSXML").value = ts.ReadAll();  
            }  
            function init() {  
                document.getElementById('file1').value = filePath;  
                readFile(filePath);  
            }  
        </script>  
    </head>   
<body >  
        <table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#CACA00" style="border-collapse: collapse;">  
            <caption align="center"> <font size="5px"><b>接口测试（HTTP + XML）</b></font><p/></caption>  
            <tr>  
                <td colspan=2>  
                    <div class="tit1">请求地址：  
					 <input type="text" id="servletur2" value="http://127.0.0.1:8080/ffinterface/ffcgi.do" style="width:50%;"  class="tit0" >   
                        
                        <input type="button" style="height:30px;"  id="send" value="    请    求    " onclick="sendxml()"/><p/>  
                    </div>  
                </td>  
            </tr>  
            <tr>  
                <td colspan=2>  
                    <div class="tit1">XML文件：  
                    <input type="text" id="file1" value="" style="width:50%;"  class="tit0" readonly>   
                    <input type="button" id="file2" style="height:30px;"   value="    浏    览    " onclick="file3.click();file1.value=file3.value;readFile(file1.value);">  
                    <input type="file" id="file3" style="display:none" style="width:50%;"  class="tit0">  
                    </div>  
                </td>  
            </tr>  
            <tr>  
                <td class="tit1"><b>发送报文</b>   
                    <input type="button" style="height:30px;"  value="清 空" onclick="document.getElementById('RSXML').value='';">  
                    <input type="button" style="height:30px;"  value="复 制" onclick="window.clipboardData.setData('text', document.getElementById('RSXML').value);">  
                </td>   
                <td class="tit1"><b>接收报文</b>   
                    <input type="button" style="height:30px;"  value="清 空" onclick="document.getElementById('RQXML').value='';">  
                    <input type="button" style="height:30px;"  value="复 制" onclick="window.clipboardData.setData('text', document.getElementById('RQXML').value);">  
                </td>  
            </tr>   
            <tr>  
                <td><textarea id="RSXML" style="width:100%;height:400px;" class="tit2"></textarea></td>  
                <td><textarea id="RQXML" style="width:100%;height:400px;" class="tit2"></textarea></td>  
            </tr>  
        </table>  
        <div id="resultword"  align="center" style="display:none;color:red;font-size:25px;">  
            已将文本“复制到剪切板中的内容。”复制到剪切板！！  
        </div>  
</body>   
</html> 